#pragma once
#include <Windows.h>
#include <ctime>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

//using namespace std;

class StringTool
{
public:
    //convert string to wstring
    static std::wstring string2wstring(std::string str, int encode = CP_ACP);
    static std::string wstring2string(std::wstring wstr, int encode = CP_ACP);
    static std::wstring formatTime(uint64_t msTime);
    static std::vector<std::string> Stringsplit(std::string str, const char split);
    static std::vector<std::wstring> WStringsplit(std::wstring str, const wchar_t split = L'_');
    static std::string GetStrTime_Now();

    static std::wstring DetTimeStamp_to_wstring(uint64_t ts);
    static std::string TimeStamp_to_String(uint64_t ts, int X_10_ns = 1);
    static std::string FtTimeStamp_to_String(uint64_t &ft100ns, uint32_t &ft10ns);
    static std::wstring TimeStamp_to_WString(uint64_t ts, int X_10_ns = 1);
    static uint64_t GetNow_FileTime_UTC();
    static uint64_t FileTime_UTC_to_LTC(uint64_t TsUTC);
    static uint64_t FileTime_LTC_to_UTC(uint64_t TsLTC);
    static bool getTSByFileKeyStr(std::wstring keyFileName, uint64_t &ts, uint32_t &ts_10ns);
    static bool getTSByFileNameStr(std::string keyFileName, uint64_t &ts_100ns, uint32_t &ts_10ns);

    static std::string uint64TS_to_SqlDateTime2(uint64_t ts);
    static std::wstring getSrcFileByBurstFile(int channelId, std::wstring burstFile);
    static std::vector<uint8_t> bytes_to_bits(std::vector<uint8_t> data);
    static uint64_t fileTimeToUnixTimeStamp(uint64_t fileTime100Nano);
    static int getRandomInt(int min, int max);
    static void FileTimeToUnixTime(uint64_t &ft_100ns, uint32_t &mFileTS_10ns, int64_t &seconds, int64_t &nanoseconds);
};
